package LEETCODE2023.BISHUA100;

public class SolutionBM34 {
    int pre = Integer.MIN_VALUE;
    public boolean isValidBST (TreeNode root) {
        // write code here
        if(root==null){
            return true;
        }
        if(!isValidBST(root.left)){
            return false;
        }
        if(root.val<pre){
            return false;
        }
        pre = root.val;
        return isValidBST(root.right);
    }
}
